home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / Binding / BindngH.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  7.9 KB  |  243 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        BindngH.h
  3.  
  4.     Contains:    Class definition for Binding helper object
  5.  
  6.     Owned by:    Caia Grisar 
  7.  
  8.     Copyright:    © 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <2>      1/8/96    CG        1299331 1.0.1: Substitution warning dlg
  13.                                     nolonger displayed in background.
  14.          <5>     8/30/95    CG        #1244563 FB1:Missing editor needs
  15.                                     explanatory alert
  16.                                     #1215054 FB: Too many substitute editor
  17.                                     dialogs
  18.          <4>     6/16/95    CC        1259719: Added ChangeEditor and
  19.                                     ChangeKindAndEditor.
  20.          <3>     5/18/95    CG        #1249263 BB: BndNSUtl.cpp does not compile
  21.                                     standalone.
  22.          <2>     4/27/95    CC        1243813: Removed ShowAlert and
  23.                                     BindingDialogFilter; replaced by ShowAlert
  24.                                     in DlogUtil.
  25.          <1>     4/13/95    CG        first checked in
  26.          <8>    12/13/94    CG        #1193522: Added Binding Alert.
  27.          <7>     8/24/94    CG        #1181622: Updated ownership info.
  28.          <6>     8/17/94    CG        #1181440: ViewNameSpace now return
  29.                                     ODObjectNameSpace.  Made methods
  30.                                     nonvirtual.
  31.          <5>     7/29/94    CG        NameSpace API changes.
  32.          <4>     7/26/94    jpa        Don't inherit from ODObject.
  33.          <3>     6/27/94    CG        Moved IsEditorLoaded here from Prefs,
  34.                                     Removed fEv
  35.          <2>     6/23/94    eeh        remove EditorSet and ODEditorSetIterator
  36.          <1>     6/15/94    CG        first checked in
  37.          <1>      6/1/94    CG        first checked in
  38.         <14>     5/27/94    CG        #1165186: Abstracted out preferences from
  39.                                     Binding object.
  40.         <13>     4/13/94    TÇ        #1147222: Fix the View As popup in the Part
  41.                                     Frame Info dialog.  Also fix the Category
  42.                                     text, and the Kind & Editor popups to show
  43.                                     the current kind & editor respectively.
  44.                                     Made one method public for PtFrInfo.cpp to
  45.                                     use.
  46.         <12>      4/4/94    CC        GetKindsSupported() and
  47.                                     GetCategoriesOfKind() return ODTypeList
  48.                                     (1153046).
  49.         <11>     3/26/94    NP        1152831. Move private functions here.
  50.         <10>     3/23/94    CG        Added VerifyPrefFileVersion() and
  51.                                     UpdatePrefFileVersion() private methods.
  52.          <9>     3/15/94    MB        Changes to support SCpp/ASLM builds,
  53.                                     #1150864.
  54.          <8>     3/14/94    CC        Added GetCurrentEditorForPart() (#1150376);
  55.                                     Made EditorSupportsKind() and
  56.                                     GetKindsSupported() public for
  57.                                     LinkDlgs.cpp.
  58.          <7>     3/11/94    CG        Bug # 1150204 - NMAPs are now loaded
  59.                                     whenever mod date of registered library
  60.                                     folder changes.
  61.          <6>     2/17/94    eeh        bug #1143340: made various private methods
  62.                                     public (to call from EdPrfInf.cpp)
  63.          <5>      2/3/94    CG        Added fHeap field.
  64.          <4>     1/12/94    CG        Removed ODCategorySet.
  65.          <3>    12/16/93    TÇ        moved typedef of ODEditor to PlfmType.h
  66.          <2>    12/10/93    CG        Added ASLM class id definition for the
  67.                                     ODBinding object.
  68.          <1>     11/7/93    TÇ        first checked in
  69.     To Do:
  70. */
  71.  
  72. #ifndef _BINDNGH_
  73. #define _BINDNGH_
  74.  
  75. #ifndef _PLFMDEF_
  76. #include "PlfmDef.h"
  77. #endif
  78.  
  79. #ifndef _ODOBJ_
  80. #include "ODObject.xh"
  81. #endif
  82.  
  83. #ifndef _ODTYPES_
  84. #include "ODTypes.h"
  85. #endif
  86.  
  87. //=====================================================================================
  88. // Theory of Operation
  89. //=====================================================================================
  90.  
  91. /*
  92.     This file describes the ODBinding class. 
  93.     ODBinding is a system service that is used to bind part data to part editors.
  94.     ODBinding also includes a number of utility functions, including mapping content
  95.     kinds to categories, providing a list of part editors supporting a given kind, and 
  96.     routines to access and set system-wide editor preferences.
  97. */
  98.  
  99.  
  100. //=====================================================================================
  101. // Classes defined in this interface
  102. //=====================================================================================
  103. class Binding;
  104.  
  105. //=====================================================================================
  106. // Classes used by this interface
  107. //=====================================================================================
  108. class ODStorageUnit;
  109. class ODDraft;
  110. class ODTypeList;
  111. class ODSession;
  112. class ODObjectNameSpace;
  113. class ODNameSpaceManager;
  114. class ODValueNameSpace;
  115. class OrderedCollection;
  116. class OrderedCollectionIterator;
  117. class ODFile;
  118. class EditorSet;
  119. class ODPart;
  120.  
  121. //==============================================================================
  122. // function prototypes
  123. //==============================================================================
  124.  
  125. #ifdef __cplusplus
  126. extern "C" {
  127. #endif
  128.  
  129. #pragma lib_export on
  130.  
  131. ODBoolean     IsNoPart(Environment* ev, ODPart* rootPart);
  132. ODEditor     GetCurrentEditorForPart(ODPart* part );
  133. void        ChangeEditor(ODPart* part, ODEditor editorID); 
  134. void        ChangeKindAndEditor (Environment *ev,
  135.                 ODPart* part,
  136.                 ODType newKind,
  137.                 ODEditor newEditor,
  138.                 ODNameSpaceManager* nsm);
  139.  
  140. #pragma lib_export off
  141.  
  142. #ifdef __cplusplus
  143. }
  144. #endif
  145.  
  146. //=====================================================================================
  147. // Class Binding
  148. //=====================================================================================
  149.  
  150. class Binding
  151. {
  152. public:
  153.     
  154.     Binding();
  155.     
  156.         // ODSession creates one instance of Binding
  157.         // which is then shared among clients within the process.
  158.         
  159.     ODVMethod ~Binding();
  160.     
  161.     ODNVMethod void InitBinding(ODSession* session);
  162.                   
  163.     ODNVMethod ODSize Purge(ODSize size);
  164.     
  165.     //---------------------------------
  166.     // Direct editor bindings
  167.  
  168.     ODNVMethod ODEditor ChooseEditorForPart(ODStorageUnit* thePartSU, ODType newKind );
  169.         // Returns the "best" available editor for the part
  170.         // may invoke automatic translation
  171.  
  172.     ODNVMethod ODEditor TranslateAndChooseEditorForPart(ODStorageUnit* thePartSU);
  173.         // attempt to intelligently translate one of the kinds in the part into 
  174.         // a kind which an available editor supports, and return that editor
  175.  
  176.     //---------------------------------
  177.     // Editor related utility methods
  178.  
  179.     ODNVMethod ODTypeList* GetKindsSupported(ODEditor editor);
  180.         // Returns the set of data types supported (without translation) by the
  181.         // argument editor.
  182.  
  183.     ODNVMethod ODContainerSuite GetContainerSuite(ODContainerType containerType);
  184.     
  185.     ODNVMethod ODBoolean EditorExists(ODEditor editor);
  186.         // Returns true if the argument editor is present on this machine.
  187.         
  188.     ODNVMethod ODBoolean    IsEditorLoaded(ODEditor editor);
  189. private:
  190.  
  191.     ODNVMethod ODEditor ChooseDirectEditorForPart(ODStorageUnit* thePartSU, ODType newKind );
  192.         // Returns the "best" available editor for the part
  193.         // without translation.
  194.     
  195.     ODNVMethod ODEditor ChooseDirectEditorForKind(ODType aKind, ODStorageUnit* thePartSU);
  196.         // Returns the "best" available editor which supports kind aKind of the part
  197.         // without translation.
  198.  
  199.     //---------------------------------
  200.     // Editor related utility methods
  201.  
  202.     ODNVMethod ODEditor GetPreferredEditorForPart(ODStorageUnit* thePartSU, ODBoolean* noPrefEditor);
  203.         // Returns the editor that last externalized the argument storage unit.
  204.         // Null is returned if that editor is not present on the current machine.
  205.         // noPrefEditor is set to true if no kODPropPreferredEditor property exists in the SU
  206.  
  207.     ODNVMethod ODEditor AlphaNumChooseEditor(EditorSet* editorSet);
  208.         // Returns the (alphanum preferred editor over viewer) from 
  209.         // the set of Editors
  210.         
  211.     ODNVMethod ODEditor AlphaNumChooseAnEditorFromTwo(ODEditor e1, ODEditor e2);
  212.         // Returns the (alphanum preferred editor over viewer) of the two editors
  213.         
  214.     ODNVMethod ODBoolean DraftRestrictsEditors(ODDraft* draft);
  215.         // Returns true if the argument draft restricts the editors that may be
  216.         // used in this document.
  217.  
  218.     ODNVMethod EditorSet* GetAllRestrictedEditorsForKind(ODDraft* draft, ODType kind);
  219.         // returns subset of restricted editors of draft which support kind.
  220.         
  221.     //---------------------------------
  222.     // Category and kind mappings
  223.  
  224.     ODNVMethod ODObjectNameSpace*        ViewerNameSpace();
  225.  
  226.     //---------------------------------
  227.     // Alert Utilities
  228.     ODNVMethod void SubstitutionWarning(ODEditor theEditor, ODStorageUnit* thePartSU);
  229.  
  230.     ODNVMethod ODBoolean NotifiedSubstitutions(ODEditor theEditor, 
  231.                                                             ODISOStr theCategory);
  232.     
  233.  
  234. // Fields:
  235.  
  236.     ODSession*             fSession;
  237.     ODValueNameSpace*    fSubstitutionList;
  238.     NMUPP                fNMResponseUPP;
  239.     NMRecPtr            fNMRecPtr;
  240. };
  241.  
  242.  
  243. #endif // _BINDNGH_